package com.hundsun.cprs.yyt.service.quota.dao;

import com.hundsun.cprs.yyt.service.quota.domain.QuotaHold;
import com.hundsun.cprs.yyt.service.quota.domain.query.QuotaHoldQuery;
import com.hundsun.cprs.yyt.service.quota.dto.QuotaHoldInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface QuotaHoldDao {
    int deleteByPrimaryKey(Long id);

    int insert(QuotaHold record);

    QuotaHold selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(QuotaHold record);

    List<QuotaHoldInfo> queryByPage(QuotaHoldQuery query);

    QuotaHoldInfo selectByUserAndQuotaId(@Param("userId") Long userId, @Param("quotaId") Long quoteId);

    /**
     * 配额数量更新
     * @param userId
     * @param quotaId   配额类型id
     * @param currentAmount 更新当前量
     * @param freezeAmount  更新冻结量
     * */
    int updateQuotaAmount(@Param("userId") Long userId, @Param("quotaId") Long quotaId,
                          @Param("currentAmount") Long currentAmount,@Param("freezeAmount")Long freezeAmount);
    
    QuotaHoldInfo sumRemainingQuotaByQuery(QuotaHoldQuery query);

}